#include <iostream>
#include <algorithm>

using std::cout;
using std::endl;

/*
2 3 2 5 2 3
*/
void solution(int *arr, int len, int peoples)
{
    std::sort(arr, arr + len, [](int l, int r){return l < r;}); 

    int idx = 0;
    int time[len] = {0};

    for(int i{0}; i < peoples; i++){
        int curT = arr[0] * (time[0] + 1);
        int pickI = 0;
        for(int j{1}; j < len; j++){
            int t = arr[j] * (time[j] + 1);
            if(t < curT){
                pickI = j;
            }
        }
        time[pickI] += 1;
    }


    for(auto i: time){
        cout << i << " ";
    }
    cout << endl;
}

int main(int args, char *argv[])
{
    int arr[] = {2, 5, 3};
    int len = sizeof(arr) / sizeof(arr[0]);
    solution(arr, len, 15);
    return 0;
}